var e = require("../../@babel/runtime/helpers/interopRequireDefault")(require("../../@babel/runtime/regenerator")),
  t = require("../../@babel/runtime/helpers/asyncToGenerator"),
  a = require("../../@babel/runtime/helpers/defineProperty"),
  i = getApp(),
  o = require("../../mybehaviors/getInvite/getInvite"),
  r = require("../../utils/themeSkin/skinBehavior");

Page({
  behaviors: [o, r],
  data: {
    iconNum:"0",
    themeStyle: null,
    U_tabcontrol: !0,
    order_active: 0,
    plugin_active: "recommend_goods",
    order_list: [],
    pluginsList: [],
    plugin_handle_list: [],
    plugins_data: [],
    service: "",
    showPopup: !1,
    btnData: {
      button_size: 40,
      over_top: 500,
      position_location: "right",
      icon_url: ""
    },
    goodsData: {
      preview_color: "#f5f5f5",
      sort_style: {
        choose_icon: "2"
      },
      padding_top: 0,
      padding_bottom: 0,
      padding_left: 10,
      padding_right: 10,
      item_radius: 5,
      show_shadow: !1,
      show_border: !1,
      border_color: "#BFB7B7",
      good_tag: {
        choose_icon: "0",
        image: ""
      },
      button_type: "3",
      button_title: "立即购买",
      button_bg_color: "#ff2c29",
      button_color: "#ffffff",
      content_list: ["1", "3", "4", "7"],
      show_price_text: !1,
      disable_good: "0",
      goods_type: "list"
    },
    limitData: {
      preview_color: "#f5f5f5",
      sort_style: {
        choose_icon: "2"
      },
      padding_top: 0,
      padding_bottom: 0,
      padding_left: 10,
      padding_right: 10,
      item_radius: 5,
      show_shadow: !1,
      show_border: !1,
      border_color: "#BFB7B7",
      good_tag: {
        choose_icon: "0",
        image: ""
      },
      button_type: "3",
      button_title: "立即购买",
      button_bg_color: "#ff2c29",
      button_color: "#ffffff",
      content_list: ["1", "3", "4", "7"],
      show_price_text: !1,
      disable_good: "0",
      goods_type: "list"
    },
    articleData: {
      get_style: "1",
      get_number: 999,
      article_style: "2",
      article_bg: "#f5f5f5",
      show_tab: !0,
      article_tab_bg: "#ffffff",
      title_color: "#333",
      title_active_color: "#ff2c29"
    },
    storeData: {
      get_number: 999,
      preview_color: "#f5f5f5",
      font_size: 14,
      font_color: "#666666",
      border_radius: 35,
      class_font_size: 14,
      class_font_color: "#ffffff",
      class_bg_color: "#adadad",
      class_border_radius: 5,
      location_font_size: 14,
      location_font_color: "#666666",
      discount_font_size: 14,
      discount_title_color: "#ff2c29",
      discount_font_color: "#666666",
      discount_list: ["1", "2", "3", "4"],
      tag_font_size: 14,
      tag_font_color: "#666666",
      tag_bg_color: "#f3f2f2",
      tag_border_color: "#ff8400",
      tag_border_radius: 5,
      show_goods: !0,
      tab_list: [],
      tab_bg_color: "#ffffff",
      tab_color: "#333333",
      tab_active_color: "#ff8400"
    },
    communityData: {
      get_style: "1",
      get_number: 999,
      preview_color: "#f5f5f5",
      tab_bg: "#ffffff",
      title_color: "#333",
      title_active_color: "#ff2c29"
    },
    videoData: {
      preview_color: "#f5f5f5",
      get_style: "1",
      get_number: 999
    },
    liveData: {
      choose_tab: "0",
      get_number: 20,
      preview_color: "#f5f5f5",
      record_id: 1,
      tab_active_color: "#ff2c29",
      tab_bg_color: "#ffffff",
      tab_color: "#333333"
    },
    groupList: [],
    groupListPage: 0,
    groupListTotalPage: 0,
    show_member_id: "",
    member_agent: "",
    lsgow: !1,
    logintap: !1,
    language: {},
    showDiy: [],
    level_name: "",
    nickname: "",
    mobile: "",
    isshow: !1,
    supplier_id: "",
    store_set: {
      is_cash_pay: "",
      is_open_cashier: "",
      is_write_information: ""
    },
    signs: !1,
    sign_name: "",
    isMemberGrade: !1,
    helps: !1,
    help_name: "",
    haveShop: "",
    relation_switch: 0,
    supplier: "",
    member_item: "",
    coupon: {},
    inviteCode: "",
    isshowInvit: "",
    isGeneralize: "",
    avatar: "",
    integral: "",
    copyright: "",
    copyrightImg: "",
    credit: "",
    custom_value: "",
    validity_value: "",
    isELive: !1,
    love_obj: {},
    is_stroeWithdraw: !1,
    activeNames: [],
    template: "",
    poster: "",
    PageNameList: {},
    footshow: !1,
    isMCreated: 0,
    designerReadly: !1,
    firstshow: !1,
    showcarrfootBol: !1,
    dataIs: "block",
    iPnoneBottomBol: !1,
    TemplateArray_1: [],
    TemplateArray_2: [],
    TemplateArray_3: [],
    page_id: "",
    components: [],
    advertising: {},
    isDecorate: !1,
    clientWidth: "375",
    popShow: !1,
    btnFlag: !1,
    bottomShowBol: !1,
    bottomShowBolIndex: 0,
    images: {},
    showChangeID: !1,
    changidInfo: {
      uid: null,
      change_uid: null
    },
    AuthorizedPhone: "",
    current_page: 1,
    total_page: 0,
    decorate_isLoadMore: !0,
    lastIndex: "",
    PlatformAgreement: "",
    openPlatformAgreement: !1,
    tapSelectAgreement: !0,
    agreement_name: "平台协议",
    store_alone_temp: 0,
    canIUseGetUserProfile: !1,
    showAutoBindPhone: !1,
    canIUseGetUserProfileTap: !1,
    order_active_show: !0,
    notShow: ["lifeService", "uidCode", "teamSell", "eliteAwardHome", "admarketHome", "Bonus", "extendHelper", "publish_manage", "hireCarManage", "TransHome", "ReplenishmentApply", "DeliveryTerminalApply", "footprintMember", "oilStation", "signIndex", "gduIndex"],
    cat_adv_url: "",
    member_team: {},
    hideAddress: !1,
    teamNameShow: !1,
    customerCenter: !1,
    editMemberPopupShow: !1,
    poster_center_is_replace: !1,
    address: {},
    niuNum: 0, //牛数量
    newNiuNum: 0, //小牛数量
    isHaveXiaoniuShow: false,//是否可以领取小牛
  },
  
  imageLoad: function (e) {
    var t = {
      width: e.detail.width,
      height: e.detail.height
    };
    this.setData({
      images: t
    });
  },
  copyLink: function () {
    i._isTextEmpty(this.data.cat_adv_url) || wx.navigateTo({
      url: this.data.cat_adv_url
    });
  },
  // 跳转到牛详情
  toNiuDetail(e){
    console.log(e.currentTarget.dataset.type,'跳转到牛详情')
    wx.navigateTo({
      url: '/packageD/tuiguangNiuDetail/tuiguangNiuDetail?type=' + e.currentTarget.dataset.type,
    })
  },
  // 领取小牛
  lingquXiaoniu:function(){
    var e = i.getNetAddresss("HuanNiu.lingqu_xiaoniu"),
      t = this;
      if(wx.getStorageSync('uid')){
        i._getNetWork({
          url: e,
          data: {
            uid: wx.getStorageSync('uid')
          },
          success: function (e) {
            var a = e.data;
            if (1 == a.result) {
              console.log(a.data,'lingquXiaoniu')
              t.getIsHaveXiaoniu()
              // if(a.data == 1){
              //   t.getIsHaveXiaoniu()
              // }else {
              //   wx.showToast({
              //     title: a.msg,
              //     icon: 'error'
              //   })
              // }
            }else {
              wx.showToast({
                title: a.msg,
                icon: 'error'
              })
            }
          }
        })
      }
  },
  // 任何级别的会员推荐普通会员达2个有效自动送银牛一头，需领取一下
  getIsHaveXiaoniu:function(){
    var e = i.getNetAddresss("HuanNiu.tuijian_xiaoniu"),
      t = this;
      if(wx.getStorageSync('uid')){
        i._getNetWork({
          url: e,
          data: {
            uid: wx.getStorageSync('uid')
          },
          success: function (e) {
            var a = e.data;
            if (1 == a.result) {
              console.log(a.data,'getIsHaveXiaoniu')
              if(a.data == 1){
                t.setData({
                  isHaveXiaoniuShow: true
                  // isHaveXiaoniuShow: false
                })
              }else {
                t.setData({
                  isHaveXiaoniuShow: false
                })
              }
            }
          }
        })
      }
  },
  getNewNiuNum:function(){
    console.log('getNewNiuNum')
    var e = i.getNetAddresss("HuanNiu.new_niu_num"),
      t = this;
      if(wx.getStorageSync('uid')){
        i._getNetWork({
          url: e,
          data: {
            uid: wx.getStorageSync('uid')
            // uid: 40211
          },
          success: function (e) {
            var a = e.data;
            if (1 == a.result) {
              t.setData({
                niuNum: a.data.niu,
                newNiuNum: a.data.xiaoniu
              })
            }
          }
        })
      }
   
  },
  getTemplate_1: function () {
    var e = i.getNetAddresss("member.member.getMiniTemplateCorrespond"),
      t = this;
    i._getNetWork({
      url: e,
      data: {
        small_type: 4
      },
      success: function (e) {
        var a = e.data;
        if (1 == a.result) {
          for (var i = [], o = 0; o < a.data.length; o++) i.push(a.data[o].template_id);
          t.setData({
            TemplateArray_1: i
          }), wx.requestSubscribeMessage({
            tmplIds: t.data.TemplateArray_1,
            success: function (e) {
              wx.navigateTo({
                url: "/packageA/member/SupplierCenter/SupplierCenter?uid=" + t.data.supplier_id
              });
            },
            fail: function () {
              wx.navigateTo({
                url: "/packageA/member/SupplierCenter/SupplierCenter?uid=" + t.data.supplier_id
              });
            }
          });
        } else wx.showToast({
          title: a.msg,
          icon: "none",
          duration: 1500
        });
      },
      fail: function (e) {
        console.log(e);
      }
    });
  },
  getTemplate_2: function () {
    var e = i.getNetAddresss("member.member.getMiniTemplateCorrespond"),
      t = this;
    i._getNetWork({
      url: e,
      data: {
        small_type: 5
      },
      success: function (e) {
        var a = e.data;
        if (1 == a.result) {
          for (var i = [], o = 0; o < a.data.length; o++) i.push(a.data[o].template_id);
          t.setData({
            TemplateArray_2: i
          }), wx.requestSubscribeMessage({
            tmplIds: t.data.TemplateArray_2,
            success: function (e) {
              wx.navigateTo({
                url: "/packageC/o2o/storeManage/storeManage"
              });
            },
            fail: function () {
              wx.navigateTo({
                url: "/packageC/o2o/storeManage/storeManage"
              });
            }
          });
        } else wx.showToast({
          title: a.msg,
          icon: "none",
          duration: 1500
        });
      },
      fail: function (e) {
        console.log(e);
      }
    });
  },
  getTemplate_3: function () {
    var e = i.getNetAddresss("member.member.getMiniTemplateCorrespond"),
      t = this;
    i._getNetWork({
      url: e,
      data: {
        small_type: 6
      },
      success: function (e) {
        var a = e.data;
        if (1 == a.result) {
          for (var i = [], o = 0; o < a.data.length; o++) i.push(a.data[o].template_id);
          t.setData({
            TemplateArray_3: i
          }), wx.requestSubscribeMessage({
            tmplIds: t.data.TemplateArray_3,
            success: function (e) {
              wx.navigateTo({
                url: "/packageD/directSeeding/helperLiveList/helperLiveList"
              });
            },
            fail: function () {
              wx.navigateTo({
                url: "/packageD/directSeeding/helperLiveList/helperLiveList"
              });
            }
          });
        } else wx.showToast({
          title: a.msg,
          icon: "none",
          duration: 1500
        });
      },
      fail: function (e) {
        console.log(e);
      }
    });
  },
  onLoad: function (e) {
    if (wx.getUserProfile && this.setData({
        canIUseGetUserProfile: !0
      }), this.getiPnoneBottom(), e && e.scene) {
      var t = decodeURIComponent(e.scene);
      if (t) {
        var a = [];
        a = t.split(",");
        for (var o = 0; o < a.length; o++) {
          var r;
          "mid" == (r = a[o].split("="))[0] && i._setMid(r[1]);
        }
      }
    }
    e && e.mid && i._setMid(e.mid), this.firstlogin() ? this.setData({
      footshow: !0
    }) : (this._initData(), this.getTemp());
    try {
      var s = wx.getStorageSync("yz_basic_info");
      this.setData({
        customerCenter: s.customer_center,
        basic_info_msg: s.plugin_setting.instation_message,
        kefuNum: s.plugin_setting.yun_chat,
        hideAddress: s.globalParameter.hide_address || !1
      }), s.plugin_setting && s.plugin_setting.poster_center && 1 == s.plugin_setting.poster_center.is_open && 1 == s.plugin_setting.poster_center.is_replace && this.setData({
        poster_center_is_replace: !0
      }), console.log(hideAddress, "basic_info_msg");
    } catch (e) {}
    this.setData({
      clientWidth: wx.getSystemInfoSync().windowWidth
    }), wx.removeStorageSync("setNewDecorateMember");

   


  },
  onReady: function () {
    var e = wx.getStorageSync("langIndex");
    e && (this.setData({
      language: e.en
    }), wx.setNavigationBarTitle({
      title: this.data.language["会员中心"]
    }));
  },
  PlatformAgreementOnChange: function (e) {
    console.log(e), this.setData({
      tapSelectAgreement: e.detail
    });
  },
  PlatformAgreementTap: function () {
    this.setData({
      openPlatformAgreement: !0
    });
  },
  PlatformAgreementClose: function () {
    this.setData({
      openPlatformAgreement: !1
    });
  },
  onShow: function () {
    let that = this

    if (this.setData({
        order_active_show: !0
      }), wx.showShareMenu({
        withShareTicket: !1,
        menus: ["shareAppMessage", "shareTimeline"]
      }), this.firstlogin()) {
      this.setData({
        footshow: !0,
        lsgow: !0
      });
      try {
        var e = wx.getStorageSync("yz_basic_info");
        if (e.home && e.home.register_setting) {
          try {
            this.setData({
              PlatformAgreement: e.home.register_setting.new_agreement ? e.home.register_setting.new_agreement.replace(/<img/g, '<img style="width:100%;display:flex;"') : "",
              agreement_name: i._isTextEmpty(e.home.register_setting.agreement_name) ? this.data.agreement_name : e.home.register_setting.agreement_name
            });
          } catch (e) {
            console.log(e);
          }
          var t = e.home.mailInfo.name;
          i._isTextEmpty(e.home.register_setting.title1) && (e.home.register_setting.title1 = "欢迎来到".concat(t)),
            i._isTextEmpty(e.home.register_setting.title2) && (e.home.register_setting.title2 = "登录尽享各种优惠权益！"),
            this.setData({
              showinfo: e.home.register_setting
            });
        } else this.setData({
          showinfo: {
            title1: "欢迎来到",
            title2: "登录尽享各种优惠权益！"
          }
        });
      } catch (e) {
        console.log(e);
      }
    } else {
      1 != wx.getStorageSync("setNewDecorateMember") && (this.getMemberData(), wx.setStorageSync("setNewDecorateMember", "1"));
    }
    var t = i.getNetAddresss("HuanNiu.getNum");
    i._getNetWork({
      url: t,
      data:{
        uid:wx.getStorageSync('uid')
      },
      success: function (t) {
        if(t.data.result == 1){
          that.setData({iconNum:t.data.data})
        }
        console.log(t,"数量");
      }
    });
  },
  onHide: function () {
    this.setData({
      isshow: !1
    });
  },
  getiPnoneBottom: function () {
    try {
      wx.getStorageSync("iPhoneBottom") && this.setData({
        iPnoneBottomBol: !0
      });
    } catch (e) {}
  },
  onUnload: function () {
    wx.removeStorageSync("new_decorate"), this.setData({
      order_active_show: !1
    });
  },
  onPullDownRefresh: function () {
    console.log("onPullDownRefresh", new Date()), this.getMemberData();
  },
  onPageScroll: function (e) {
    e.scrollTop > 80 ? this.data.btnFlag || this.setData({
      btnFlag: !0
    }) : this.data.btnFlag && this.setData({
      btnFlag: !1
    }), this.data.bottomShowBol && this.setData({
      bottomShowBol: !1
    });
  },
  onReachBottom: function () {
    this.setData({
      bottomShowBol: !0
    }), this.data.decorate_isLoadMore && ("03" === this.data.template ? this.getMoreDecorate() : "01" === this.data.template && this.getMorePluginData());
  },
  onShareTimeline: function () {},
  onShareAppMessage: function () {
    var e = wx.getStorageSync("yz_uid"),
      t = "";
    return e && (t = e), {
      path: "/packageG/index/index?mid=" + t
    };
  },
  closePop: function () {
    this.setData({
      popShow: !1
    });
  },
  clearStorage: function () {
    wx.clearStorage({
      success: function () {}
    });
  },
  _initData: function () {
    this.setData({
      activeNames: []
    });
  },
  editMemberPopupClose: function (e) {
    e.detail.avatar && this.setData({
      avatar: e.detail.avatar
    }), e.detail.name && this.setData({
      nickname: e.detail.name
    });
  },
  _getMemberInfo: function (e) {
    var t = this;
    for (var i in this.data.supplier_id = e.member.uid, e.plugins.merchant && e.plugins.merchant.cashier && this.setData({
        "store_set.is_open_cashier": 1
      }), this.setData({
        relation_switch: e.member.is_agent,
        coupon: e.member.coupon || {},
        inviteCode: e.member.inviteCode.code ? e.member.inviteCode.code : "",
        isshowInvit: e.member.inviteCode.status ? e.member.inviteCode.status : "",
        isGeneralize: e.member.is_agent,
        member_item: e.member,
        member_order: e.order,
        avatar: e.member.avatar,
        nickname: e.member.nickname,
        integral: e.member.integral,
        copyright: e.member.copyright,
        copyrightImg: e.member.copyrightImg,
        uid: e.member.uid,
        level_name: e.member.level_name,
        credit: e.member.credit,
        integral_show: e.member.integral_show,
        mobile: e.member.mobile,
        love_obj: e.member.love_show
      }), 1 == e.setting.member_auth_pop_switch && 0 == e.member.has_avatar && this.setData({
        editMemberPopupShow: !0
      }), this.data.designer) {
      var o;
      this.setData((a(o = {}, "designer[" + i + "].member_item", e.member), a(o, "designer[" + i + "].member_order", e.order),
        o));
    }
    if (wx.setStorage({
        key: "uid",
        data: e.member.uid
      }),
      //  wx.setStorage({
      //   key: "integral",
      //   data: this.data.integral.text
      // }),
      wx.setStorage({
        key: "integral",
        data: "换货值"
      }),
      e.plugins.plugins) {
      e.plugins.plugins.push({
        class: "icon-zb_all_more",
        image: "",
        mini_url: "/packageG/morePlugin/morePlugin",
        name: "morePlugin",
        title: "更多工具",
        url: "morePlugin"
      });
      e.plugins.plugins.push({
        class: "icon-member-zhuanzhang",
        image: "",
        mini_url: "/packageG/transferAccounts/transferAccounts",
        name: "transferAccounts",
        title: "转账确认",
        url: "transferAccounts"
      });
      var r = [],
        s = [];
      e.plugins.plugins.forEach(function (e, a) {
        t.data.notShow.indexOf(e.url) < 0 && r.push(e);
      });
      for (var n = Math.ceil(r.length / 10), l = 0; l < n; l++) s.push(r.slice(10 * l, 10 * (l + 1)));
      this.setData({
        plugin_handle_list: s
      });
    }
    if (e.order && e.order_name) {
      var d = [];
      for (var g in e.order) {
        var c = e.order_name[g];
        e.order[g] && ("order" === g || "hotel_order" === g || "lease_order" === g || "live_install_order" === g || "live_install_work_order" === g || "group_work_order" === g ? e.order[g].push({
          status: -1,
          status_name: "全部订单",
          total: 0,
          class: "icon-fontclass-quanbudingdan"
        }) : "aggregation_cps_order" === g ? (e.order[g].push({
          status: 0,
          status_name: "全部订单",
          total: 0,
          class: "icon-fontclass-quanbudingdan"
        }), e.order[g].push({
          status: 3,
          status_name: "卡券订单",
          total: 0,
          class: "icon-fontclass-shouhou1"
        })) : "coupon_store_order" === g ? e.order[g].push({
          status: 4,
          status_name: "全部订单",
          total: 0,
          class: "icon-fontclass-quanbudingdan"
        }) : ("travel_around_order" === g || "yz_supply_cake_order" === g) && e.order[g].push({
          status: -1,
          status_name: "全部订单",
          total: 0,
          class: "icon-fontclass-quanbudingdan"
        }), d.push({
          name: g,
          title: c,
          list: e.order[g]
        }));
      }
      e.order_name.hasOwnProperty("ys_system") && d.push({
        name: "ys_system",
        title: e.order_name.ys_system,
        list: []
      }), this.setData({
        order_list: d
      });
    }
    1 == this.data.love_obj.unable_love_show && 1 == this.data.credit.is_show && 1 == this.data.integral.is_show ? this.setData({
      fire: !0
    }) : this.setData({
      fire: !1
    });
  },
  clickOrderTab: function (e) {
    "ys_system" == this.data.order_list[e.detail.name].name && wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=0&orderType=ysSystem"
    });
  },
  _getEnablePlugin: function (e) {
    var t = this,
      a = e,
      i = [],
      o = [],
      r = [],
      s = [];
    e.asset_equity && e.asset_equity.forEach(function (e, a) {
      t.data.notShow.indexOf(e.url) < 0 && i.push(e);
    }), e.market && e.market.forEach(function (e, a) {
      t.data.notShow.indexOf(e.url) < 0 && o.push(e);
    }), e.merchant && e.merchant.forEach(function (e, a) {
      t.data.notShow.indexOf(e.url) < 0 && r.push(e);
    }), e.tool && e.tool.forEach(function (e, a) {
      t.data.notShow.indexOf(e.url) < 0 && s.push(e);
    }), a.asset_equity = i, a.market = o, a.merchant = r, a.tool = s, this.setData({
      pluginsList: a
    });
    var n = this.data.template;
    n = e.ViewSet.member && e.ViewSet.member.name ? e.ViewSet.member.name : "01";
    var l = wx.getStorageSync("yz_basic_info");
    l && 1 === l.home.item.is_decorate && (n = 0 != l.home.item.ViewSet.member.is_default ? l.home.item.ViewSet.member.code.substring(6) : "01"),
      this.data.designerStatus && (n = "03"), this.setData({
        template: n
      }), "03" !== this.data.template && wx.setNavigationBarColor({
        frontColor: "#ffffff",
        backgroundColor: this.data.themeBaseColor,
        animation: {
          duration: 400,
          timingFunc: "easeIn"
        }
      });
  },
  gotoMemberGrade: function () {
    this.data.isMemberGrade && wx.navigateTo({
      url: "/packageB/member/MemberGradeList/MemberGradeList"
    });
  },
  _getMemberGrade: function (e) {
    for (var t in this.setData({
        isMemberGrade: 1 == e.is_open
      }), this.data.designer) this.setData(a({}, "designer[" + t + "].isMemberGrade", this.data.isMemberGrade));
  },
  golove_index: function () {
    wx.navigateTo({
      url: "/packageB/member/love/Love_index/Love_index"
    });
  },
  gobalance: function () {
    1 == this.data.store_alone_temp ? wx.navigateTo({
      url: "/packageI/independenceBalance/independenceBalance?store_id=" + i.globalData.STORE_ID
    }) : wx.navigateTo({
      url: "/packageA/member/balance/balance/balance"
    });
  },
  Integral_love: function () {
    wx.navigateTo({
      url: "/packageB/member/Integral_love/Integral_love"
    });
  },
  ecological_point: function () {
    wx.navigateTo({
      url: "/packageA/member/balance/balance/balance?name=cat"
    });
  },
  CardIndexPage: function () {
    wx.navigateTo({
      url: "/packageB/member/CardIndex/CardIndex"
    });
  },
  gointegral: function () {
    wx.navigateTo({
      url: "/packageA/member/balance/balance/balance"
    });
  },
  gointegral_v2: function () {
    wx.navigateTo({
      url: "/packageB/member/integral/integral"
    });
  },
  goextension: function () {
    wx.reLaunch({
      url: "/packageG/pages/member/extension/extension"
    });
  },
  goorderlist: function (e) {
    var t = e.currentTarget.dataset.status;
    wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + t
    });
  },
  goaftersaleslist: function () {
    wx.navigateTo({
      url: "/packageD/member/myOrder/Aftersaleslist/Aftersaleslist"
    });
  },
  gocollection: function (e) {
    wx.navigateTo({
      url: "/packageD/member/collection/collection"
    });
  },
  gofootprint: function (e) {
    wx.navigateTo({
      url: "/packageD/member/footprint/footprint"
    });
  },
  gomyEvaluation: function (e) {
    wx.navigateTo({
      url: "/packageD/member/myEvaluation/myEvaluation"
    });
  },
  gomyRelationship: function (e) {
    this.data.customerCenter ? wx.navigateTo({
      url: "/packageF/others/customerCenter/customerCenterIndex/customerCenterIndex"
    }) : wx.navigateTo({
      url: "/packageD/member/myRelationship/myRelationship"
    });
  },
  goaddress: function (e) {
    wx.navigateTo({
      url: "/packageD/member/addressList/addressList"
    });
  },
  gocoupon: function (e) {
    wx.navigateTo({
      url: "/packageA/member/coupon_v2/coupon_v2"
    });
  },
  goinfo: function (e) {
    wx.navigateTo({
      url: "/packageA/member/info/info"
    });
  },
  goQucik: function (e) {
    wx.navigateTo({
      url: "/packageD/quickPay/quick_index/quick_index"
    });
  },
  gosign: function () {
    wx.navigateTo({
      url: "/packageA/member/sign/sign"
    });
  },
  gocashier: function () {
    wx.navigateTo({
      url: "/packageC/cashier/cashier/cashier"
    });
  },
  gomicroShop_home: function () {
    wx.navigateTo({
      url: "/packageC/microshop/microShop_home/microShop_home"
    });
  },
  gomicroShop_apply: function () {
    wx.navigateTo({
      url: "/packageC/microshop/microShop_apply/microShop_apply"
    });
  },
  golifeService: function () {},
  gooverseas_index: function () {
    wx.navigateTo({
      url: "/packageB/member/overseas_index/overseas_index"
    });
  },
  gostoreManage: function () {
    this.getTemplate_2();
  },
  gohelpcenter: function () {
    wx.navigateTo({
      url: "/packageB/member/helpcenter/helpcenter"
    });
  },
  goFrozenCoin: function () {
    wx.navigateTo({
      url: "/packageB/member/FrozenCoin/FrozenCoin"
    });
  },
  _getExtension: function (e) {
    this.setData({});
  },
  _getStroeWithdraw: function (e) {
    e && this.setData({
      is_stroeWithdraw: 1 == e.is_store
    });
  },
  pluginGoto: function (e) {
    var t = e.currentTarget.dataset.item,
      a = t.url;
    if ("courier" == t.name) wx.setStorage({
      key: "couriername",
      data: t.title
    }), wx.navigateTo({
      url: "/packageA/member/" + a + "/" + a
    });
    else if ("SupplierCenter" == t.url) {
      this.getTemplate_1();
    } else if ("extension" == t.url) this.goextension();
    else if ("storeManage" == t.url) this.gostoreManage();
    else if ("supplier" == t.name) wx.navigateTo({
      url: "/packageA/member/" + a + "/" + a + "?uid=" + this.data.supplier_id
    });
    else if ("HotelManage" == t.url) wx.navigateTo({
      url: "/packageA/hotel/HotelManage/HotelManage?title=" + encodeURIComponent("酒店管理")
    });
    else if ("helperLiveList" == t.url) {
      this.getTemplate_3();
    } else "cloudIndex" == t.url ? wx.navigateTo({
      url: "/packageE/others/cloudwarehouse/cloud_index/cloud_index"
    }) : "collageIndex" == t.url ? wx.navigateTo({
      url: "/packageE/member/collage/collageIndex/collageIndex"
    }) : "m-erweima" == t.name ? this.openQrCode(this.data.dataIs) : t.mini_url &&  wx.navigateTo({
      url: t.mini_url
    });
    // : "m-erweima" == t.name ? this.openQrCode(this.data.dataIs) : t.mini_url && "store-cashier" == t.name ? this.applyStore() : wx.navigateTo({
    //   url: t.mini_url
    // });
  },
  applyStore: function () {
    console.log('申请门店')
    // HuanNiu.zhuce_store
    let _this = this
    var o = i.getNetAddresss("HuanNiu.zhuce_store");
    i._getNetWork({
      url: o,
      data: {
        uid: wx.getStorageSync('uid'),
        longitude: wx.getStorageSync('address').lon,
        latitude: wx.getStorageSync('address').lat,
      },
      success: function (t) {
        var a = t.data;
        if (1 == a.result) {
          console.log(a, 'aaaaaaaaaaa')
          _this.getMemberData()
        }
      },
      fail: function (e) {
        console.log(e);
      }
    });
  },
  onChange: function (e) {
    this.setData({
      activeNames: e.detail
    });
  },
  openQrCodebtn: function () {
    this.openQrCode(this.data.dataIs);
  },
  showcarrfoot: function (e) {
    var t = e.detail;
    this.setData({
      showcarrfootBol: t
    });
  },
  showcarrfoot_ipx: function (e) {
    var t = e.detail;
    this.setData({
      showcarrfootBol: t
    });
  },
  openQrCode: function (e) {
    this.data.poster_center_is_replace ? wx.navigateTo({
      url: "/packageI/newPoster/newPoster"
    }) : this.setData({
      isshow: !0
    });
  },
  clicktapshow: function () {
    this.setData({
      isshow: !1,
      lsgow: !1
    });
  },
  previewImage: function () {
    wx.showToast({
      title: "长按分享好友",
      icon: "none",
      duration: 1800
    }), wx.previewImage({
      urls: [this.data.poster]
    });
  },
  saveImg: function () {
    wx.getSetting({
      success: function (e) {
        e.authSetting["scope.writePhotosAlbum"] || wx.authorize({
          scope: "scope.writePhotosAlbum",
          success: function () {
            console.log("授权成功");
          }
        });
      }
    });
    var e = this.data.poster;
    wx.downloadFile({
      url: e,
      success: function (e) {
        wx.saveImageToPhotosAlbum({
          filePath: e.tempFilePath,
          success: function (e) {
            wx.showToast({
              title: "保存成功",
              icon: "none",
              duration: 2e3
            });
          },
          fail: function (e) {
            "saveImageToPhotosAlbum:fail auth deny" === e.errMsg && (console.log("当初用户拒绝，再次发起授权"),
              wx.openSetting({
                success: function (e) {
                  e.authSetting["scope.writePhotosAlbum"] ? wx.showToast({
                    icon: "none",
                    title: "获取权限成功,再次长按保存图片",
                    duration: 1500
                  }) : wx.showToast({
                    icon: "none",
                    title: "获取权限失败,保存图片需要用户授权",
                    duration: 1500
                  });
                }
              }));
          },
          complete: function (e) {
            console.log(e);
          }
        });
      }
    });
  },
  copybtn: function () {
    var e = this.data.inviteCode;
    wx.setClipboardData({
      data: e || "",
      success: function (e) {
        wx.showToast({
          icon: "none",
          title: "复制成功",
          duration: 1e3
        });
      }
    });
  },
  gohotelOrderlist: function (e) {
    var t = e.currentTarget.dataset.status,
      a = e.currentTarget.dataset.ordertype;
    wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + t + "&orderType=" + a
    });
  },
  gotoAftersaleslist: function (e) {
    var t = e.currentTarget.dataset.ordertype;
    wx.navigateTo({
      url: "/packageD/member/myOrder/Aftersaleslist/Aftersaleslist?orderType=" + t
    });
  },
  getCustomizeHotelHead: function () {
    var e = this,
      t = "";
    try {
      var a = wx.getStorageSync("customizeHotelHead");
      a && (t = a);
    } catch (e) {}
    if (i._isTextEmpty(t)) {
      var o = i.getNetAddresss("plugin.hotel.frontend.hotel.get-hotel-info.get-custom-name");
      i._getNetWork({
        url: o,
        success: function (t) {
          var a = t.data;
          if (1 == a.result) {
            e.setData({
              PageNameList: a.data
            });
            try {
              wx.setStorageSync("customizeHotelHead", JSON.stringify(a.data));
            } catch (e) {
              console.log(e);
            }
          }
        },
        fail: function (e) {
          console.log(e);
        }
      });
    } else this.setData({
      PageNameList: JSON.parse(t)
    });
  },
  getNewDecorate: function (e) {
    this.setData({
      isDecorate: !0,
      page_id: e.id,
      components: e.datas,
      decorate_isLoadMore: !0
    }), e.page && this.setData({
      total_page: e.page.total_page,
      current_page: e.page.current_page,
      bottomShowBolIndex: e.page.count - 1
    }), e.page_info && (this.setData({
      advertising: e.page_info.advertising_id
    }), this.data.advertising.id && this.data.advertising.datas && (this.data.advertising.datas = JSON.parse(this.data.advertising.datas),
      this.setData({
        advertising: this.data.advertising
      })));
    var t = wx.getStorageSync("firstAdvertisement");
    this.data.advertising && this.data.advertising.id && !t && 1 === this.data.advertising.show_rule && (wx.setStorageSync("firstAdvertisement", !0),
      this.setData({
        popShow: !0
      }));
    var a = wx.getStorageSync("member_popAdvertisement_expiration"),
      i = parseInt(Date.parse(new Date()) / 1e3);
    if (this.data.advertising && this.data.advertising.id && 2 === this.data.advertising.show_rule && a < i) {
      var o = parseInt((new Date(new Date().toLocaleDateString()).getTime() + 864e5 - 1) / 1e3);
      wx.setStorageSync("member_popAdvertisement_expiration", o), this.setData({
        popShow: !0
      });
    }
  },
  getMoreDecorate: function () {
    var e = this;
    if (this.setData({
        decorate_isLoadMore: !1
      }), this.data.current_page < this.data.total_page) {
      this.setData({
        current_page: this.data.current_page + 1
      });
      var t = i.getNetAddresss("plugin.decorate.frotend.decorate-api.get-page");
      i._postNetWork({
        url: t,
        data: {
          decorate_page: this.data.current_page,
          decorate_id: this.data.page_id
        },
        success: function (t) {
          var a = t.data;
          1 == a.result ? e.setData({
            decorate_isLoadMore: !0,
            components: e.data.components.concat(a.data.datas)
          }) : (e.setData({
            decorate_isLoadMore: !1,
            current_page: e.data.current_page - 1
          }), console.log(a.msg));
        }
      });
    }
  },
  getStoreMember: function () {
    var e = this,
      t = i.getNetAddresss("plugin.store-alone-temp.frontend.member.index");
    i._postNetWork({
      url: t,
      data: {
        v: 2
      },
      success: function (t) {
        var o = t.data;
        if (1 == o.result) {
          var r = o.data;
          if (e.setData({
              store_alone_temp: 1,
              coupon: r.member.coupon || {},
              inviteCode: r.member.inviteCode.code ? r.member.inviteCode.code : "",
              isshowInvit: r.member.inviteCode.status ? r.member.inviteCode.status : "",
              isGeneralize: 1,
              member_item: r.member,
              member_order: r.order,
              avatar: r.member.avatar,
              nickname: r.member.nickname,
              integral: r.member.integral,
              copyright: r.member.copyright,
              copyrightImg: r.member.copyrightImg,
              uid: r.member.uid,
              level_name: r.member.level_name,
              credit: r.member.credit,
              integral_show: r.member.integral_show,
              mobile: r.member.mobile,
              love_obj: r.member.love_show,
              template: "01"
            }), wx.stopPullDownRefresh(), o.data.plugins_data && (!e.data.plugins_data.nav || e.data.plugins_data.nav.length <= 0) && (e.setData({
              plugins_data: o.data.plugins_data
            }), e.data.plugins_data.nav.length > 0 && (e.setData({
              plugin_active: e.data.plugins_data.nav[0].code
            }), "recommend_goods" === e.data.plugin_active ? e.setData(a({}, "goodsData.list", e.data.plugins_data.data)) : "limitBuy_goods" === e.data.plugin_active ? e.setData(a({}, "limitData.list", e.data.plugins_data.data)) : e.handlePlugin({
              name: e.data.plugin_active
            }))), r.plugin) {
            r.plugin.forEach(function (t, a) {
              e.data.notShow.indexOf(t.url) >= 0 && r.plugin.splice(a, 1);
            });
            for (var s = [], n = Math.ceil(r.plugin.length / 10), l = 0; l < n; l++) s.push(r.plugin.slice(10 * l, 10 * (l + 1)));
            e.setData({
              "pluginsList.plugin_head": r.plugin_head,
              plugin_handle_list: s
            });
          }
          if (r.order) {
            for (var d = [], g = 0; g < r.order.length; g++) "order" === r.order[g].key && r.order[g].order.push({
              status: -1,
              status_name: "全部订单",
              total: 0,
              class: "icon-fontclass-quanbudingdan"
            }), d.push({
              name: r.order[g].key,
              title: r.order[g].title,
              list: r.order[g].order
            });
            e.setData({
              order_list: d
            });
          }
        } else i.tips(o.msg);
        e.setData({
          firstshow: !0
        });
      }
    });
  },
  teamCancelTap: function () {
    this.setData({
      teamNameShow: !1
    });
  },
  childEdit: function (e) {
    this.data.member_item.member_team.team_name = e.detail, this.setData({
      member_item: this.data.member_item
    });
  },
  TapEdit: function () {
    this.data.member_team.can_edit && this.setData({
      teamNameShow: !0
    });
  },
  getMemberData: function () {
    var e = this;
    if (1 != i.globalData.store_alone_temp) {
      var t = this,
        o = i.getNetAddresss("member.member.member-data");
      i._getNetWork({
        url: o,
        data: {
          v: 2,
          basic_info: 1
        },
        success: function (o) {
          console.log(wx.getStorageSync('uid'),'udidudududududu')
          t.registerXiaoNiu(o.data.data.member.uid),
          t.getNewNiuNum();
          t.getIsHaveXiaoniu();
          var r = o.data;
          1 === r.result ? ("decorate" === r.data.designer.data.page_plugins ? (t.getNewDecorate(r.data.designer.data),
              t.setData({
                designerStatus: r.data.designer.status
              })) : 0 == t.data.isMCreated && t.newTemplate(r.data.designer), t._getMemberInfo(r.data),
            wx.stopPullDownRefresh(), r.data.plugins_data && (!e.data.plugins_data.nav || e.data.plugins_data.nav.length <= 0) && (t.setData({
              plugins_data: r.data.plugins_data
            }), e.data.plugins_data.nav.length > 0 && (e.setData({
              plugin_active: e.data.plugins_data.nav[0].code
            }), "recommend_goods" === e.data.plugin_active ? t.setData(a({}, "goodsData.list", e.data.plugins_data.data)) : "limitBuy_goods" === e.data.plugin_active ? e.setData(a({}, "limitData.list", e.data.plugins_data.data)) : e.handlePlugin({
              name: e.data.plugin_active
            }))), r.data.service && "string" != typeof r.data.service && (t.setData({
              service: r.data.service
            }), "0" == r.data.service.customer_open && t.setData({
              service: !1
            })), i._isTextEmpty(r.data.member) || (e.setData({
              cat_adv_url: r.data.member.small_cat_adv_url
            }), r.data.member.member_team && e.setData({
              member_team: r.data.member.member_team
            })), i._isTextEmpty(r.data.member.yz_member) || (t.data.custom_value = r.data.member.yz_member.custom_value,
              t.getMemberCustom(t.data.custom_value, r.data.member.yz_member.validity, r.data.setting.custom)),
            t._getEnablePlugin(r.data.plugins), t._getStroeWithdraw(r.data.plugins.is_open),
            t._getExtension(r.data.relation), t._getMemberGrade(r.data.setting.level), t.setData({
              show_member_id: r.data.setting.show_member_id,
              designerReadly: !0
            })) : wx.showToast({
            title: r.msg,
            icon: "none",
            duration: 1500
          }), t.setData({
            firstshow: !0
          });
        },
        fail: function (e) {
          console.log(e);
        }
      });
    } else this.getStoreMember();

    
  },
  handleContact: function (e) {
    var t = e.currentTarget.dataset.url;
    t && wx.navigateTo({
      url: t,
      fail: function (e) {
        i.tips("客服路径错误");
      }
    });
  },
  getMemberCustom: function (e, t, a) {
    a.is_validity && 1 == a.term && t && this.setData({
      validity_value: t
    });
  },
  getPoster: function () {
    var e = this,
      t = i.getNetAddresss("member.poster");
    i._getNetWork({
      url: t,
      success: function (t) {
        var a = t.data;
        1 == a.result ? (e.setData({
          poster: a.data.image_url,
          dataIs: "hook",
          isshow: !0
        }), e.data.poster && e.data.timer && (wx.hideLoading({}), clearInterval(e.data.timer))) : (this.data.timer && clearInterval(e.data.timer),
          wx.hideLoading({}), wx.showToast({
            title: a.msg,
            icon: "none",
            duration: 1500
          }));
      },
      fail: function (e) {
        this.data.timer && clearInterval(this.data.timer), wx.hideLoading();
      }
    });
  },
  getTemp: function () {
    var e = this,
      t = this;
    try {
      var a = wx.getStorageSync("yz_basic_info");
      if (a.home) t.setData({
        footshow: !0,
        member_agent: a.lang.agent && a.lang.agent.agent ? a.lang.agent.agent : "客户"
      });
      else {
        var o = i.getNetAddresss("home-page.wxapp");
        o += "&basic_info=1", i._getNetWork({
          showToastIn: !1,
          url: o,
          success: function (a) {
            var o = a.data;
            if (1 == a.result) {
              t.setData({
                footshow: !0
              });
              try {
                e.setData({
                  member_agent: o.basic_info.lang.agent && o.basic_info.lang.agent.agent ? o.basic_info.lang.agent.agent : "客户",
                  PlatformAgreement: o.basic_info.home.register_setting.new_agreement ? o.basic_info.home.register_setting.new_agreement.replace(/<img/g, '<img style="width:100%;display:flex;"') : "",
                  agreement_name: i._isTextEmpty(o.basic_info.home.register_setting.agreement_name) ? e.data.agreement_name : o.basic_info.home.register_setting.agreement_name
                });
              } catch (e) {
                console.log(e);
              }
            }
          },
          fail: function (e) {}
        });
      }
    } catch (e) {}
  },
  newTemplate: function (e) {
    var t = this;
    for (var i in t.setData({
        designer: e.data,
        isDecorate: !1
      }), t.data.designer.forEach(function (e, a, i) {
        "showdiyform" === e.temp && (t.showDiy.push(e), t.setData({
          showDiy: t.data.showDiy
        }));
      }), t.data.designer) t.setData(a({}, "designer[" + i + "].temp", "show" + t.data.designer[i].temp)),
      "showlocation" !== t.data.designer[i].temp && "showstore" !== t.data.designer[i].temp || t.setData({
        isLocation: !0
      });
    t.setData({
      designerStatus: e.status
    }), t.data.isMCreated = 1;
  },
  firstlogin: function () {
    var e = !1;
    try {
      wx.getStorageSync("wx_token") ? (this.setData({
        loginshow: !1
      }), e = !1) : (this.setData({
        loginshow: !0
      }), e = !0);
    } catch (e) {}
    return e;
  },
  gotologin: function () {
    i.seyzredirect(), wx.navigateTo({
      url: "/pages/login/login"
    });
  },
  getUserProfileTap: function (e) {
    var t = this;
    if (!this.data.canIUseGetUserProfileTap)
      if (this.setData({
          canIUseGetUserProfileTap: !0
        }), this.data.canIUseGetUserProfile) wx.getUserProfile({
        desc: "获取用户信息",
        success: function (e) {
          var a = {
            nickName: e.userInfo.nickName,
            avatarUrl: "",
            gender: e.userInfo.gender
          };
          wx.getLocation({
            type: 'gcj02', // 比较精确
            success: (res) => {
              console.log(res.latitude, res.longitude, '成功');
              let address = {
                lat: res.latitude,
                lon: res.longitude
              }
              t.setData({
                address: address
              })
              wx.setStorageSync('address', address)
              t.loginbtn(a);
            },
            fail: (res) => {
              console.log(res, '失败')
              wx.showToast({
                title: '请授权位置信息',
                icon: 'none'
              })
              // wx.hideLoading();
              t.data.canIUseGetUserProfileTap = !1;
              wx.getSetting({
                success(res) {
                  console.log(res)
                  if (res.authSetting == true) {
                    console.log('已授权')
                  } else if (res.authSetting['scope.userLocation'] == false) {
                    wx.showModal({
                      title: '提示', //提示的标题,
                      content: '请打开位置权限', //提示的内容,
                      showCancel: true, //是否显示取消按钮,
                      cancelText: '取消', //取消按钮的文字，默认为取消，最多 4 个字符,
                      cancelColor: '#000000', //取消按钮的文字颜色,
                      confirmText: '确定', //确定按钮的文字，默认为取消，最多 4 个字符,
                      confirmColor: '#3CC51F', //确定按钮的文字颜色,
                      success: res => {
                        if (res.confirm) {
                          // openSetting 是需要事件驱动的，保证它的同步性。
                          wx.openSetting({
                            success(res) {
                              console.log(res.authSetting)
                              console.log('wei授权')
                            },
                            fail(res) {
                              console.log(res)
                              console.log('wei授权1')
                            }
                          })
                        } else if (res.cancel) {
                          console.log('用户点击取消')
                          wx.showToast({
                            title: '需要位置权限',
                            icon: 'none',
                            duration: 2000,
                          })
                        }
                      }
                    })
                  }
                }
              })
            }
          })
        },
        fail: function (e) {
          console.log(e), t.setData({
            canIUseGetUserProfileTap: !1
          });
        }
      });
      else {
        var a = e.detail,
          i = {
            nickName: a.userInfo.nickName,
            avatarUrl: "",
            gender: a.userInfo.gender
          };
        t.loginbtn(i);
      }
  },
  loginbtn: function (e) {
    if (!this.data.logintap) {
      this.setData({
        logintap: !0
      });
      var t = this;
      console.log("登录中..."), wx.login({
        success: function (a) {
          console.log("login登录成功，获取用户info"), a.code ? wx.request({
            url: i.getNetAddresss("member.login.index"),
            header: {
              "Content-Type": "application/json",
              Accept: "application/json"
            },
            data: {
              code: a.code,
              info: e,
              ver: "2"
            },
            success: function (a) {
              var i = a.data;
              console.log("登录接口", a), setTimeout(function () {
                t.setData({
                  logintap: !1
                });
              }, 1e3), 1 == i.result ? (i.data.user_info && wx.setStorageSync("nickname", i.data.user_info.nickname),
                i.msg.session && wx.setStorageSync("session", i.msg.session), wx.setStorage({
                  key: "openid",
                  data: i.data.openid
                }), i.msg.wx_token && wx.setStorageSync("wx_token", i.msg.wx_token), e && wx.setStorageSync("userInfo", e),
                wx.setStorage({
                  key: "yz_uid",
                  data: i.msg.uid
                }), i.data.is_first_time_bind ? t.setData({
                  showAutoBindPhone: !0
                }) : t.getInvite(), wx.removeStorageSync("new_decorate")) : (wx.showModal({
                title: "提示",
                content: i.msg,
                success: function (e) {
                  console.log(e);
                }
              }), console.log("第三方登录数据错误" + a.errMsg));
            },
            fail: function (e) {
              t.setData({
                logintap: !1,
                canIUseGetUserProfileTap: !1
              }), console.log("第三方登录失败session、wx_token获取失败" + e.errMsg);
            }
          }) : (t.setData({
            logintap: !1,
            canIUseGetUserProfileTap: !1
          }), console.log("获取用户登录态失败！" + res.errMsg));
        },
        fail: function (e) {
          console.log("登录失败，请求被拒绝！获取用户登录态失败！" + e);
        }
      });
    }
  },
  registerXiaoNiu: function (id) {
    console.log('registerXiaoNiu',id)
    var e = this,
      t = i.getNetAddresss("HuanNiu.zhuce_xiaoniu");
    i._getNetWork({
      url: t,
      data: {
        uid: id
      },
      success: function (t) {
        e.getNewNiuNum()
        // var n = t.data;
        // if (1 == n.result) {
        //   var a = n.data;
        //   console.log('registerXiaoNiu1', a)
        //   // e.getMemberData();
        // }
        // wx.hideLoading();
      },
      fail: function (e) {
        console.log(e);
      }
    });
  },
  getInvite: function () {
    console.log('走了么')
    var e = this
    wx.request({
      url: i.getNetAddresss("HuanNiu.get_address"),
      header: {
        "Content-Type": "application/json",
        Accept: "application/json"
      },
      data: {
        latitude: e.data.address.lat,
        longitude: e.data.address.lon,
        uid: wx.getStorageSync("yz_uid")
      },
      success: function (t) {
        console.log(t, 'HuanNiu.get_address')
        var url = i.getNetAddresss("member.member.isValidatePage");
        i._getNetWork({
          url: url,
          data: {},
          success: function (t) {
            var a = t.data;
            if (1 == a.result) {
              var i = a.data;
              try {
                e.checktoInvite(i, "member");
              } catch (e) {
                wx.reLaunch({
                  url: "/packageG/index/index"
                });
              }
            }
          },
          fail: function (e) {
            console.log(e);
          }
        });

      }
    })


  },
  gomember: function () {
    wx.reLaunch({
      url: "/packageG/member_v2/member_v2"
    });
  },
  turnTo: function () {
    if (2 == this.data.advertising.is_minapp)
      if (this.data.advertising.minapp_sid)
        if (this.data.advertising.minapp_link2) try {
          wx.navigateToMiniProgram({
            appId: this.data.advertising.minapp_sid,
            path: this.data.advertising.minapp_link2,
            extraData: {},
            envVersion: "release",
            success: function (e) {},
            fail: function (e) {
              wx.showToast({
                title: "小程序跳转失败",
                icon: "none",
                duration: 2e3
              });
            }
          });
        } catch (e) {
          wx.showToast({
            title: "小程序跳转失败",
            icon: "none",
            duration: 2e3
          });
        } else wx.showToast({
          title: "请设置跳转小程序后的跳转链接",
          icon: "none",
          duration: 2e3
        });
        else wx.showToast({
          title: "请设置小程序所需跳转appId",
          icon: "none",
          duration: 2e3
        });
    else {
      var e = this.data.advertising.minapp_link;
      try {
        wx.navigateTo({
          url: e
        });
      } catch (e) {
        wx.showToast({
          title: "链接设置错误",
          icon: "none",
          duration: 2e3
        });
      }
    }
  },
  toOrderList: function (e) {
    var t = e.currentTarget.dataset.item,
      a = e.currentTarget.dataset.name;
    "hotel_order" === a || 11 !== t.status ? "order" === a ? wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + (Number(t.status) + 1)
    }) : "hotel_order" === a ? 11 === t.status ? wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=5&orderType=hotel"
    }) : wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + (Number(t.status) + 1) + "&orderType=hotel"
    }) : "fight_groups_order" === a ? wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + (Number(t.status) + 2) + "&orderType=groups"
    }) : "snatch_regiment_order" === a ? wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + (Number(t.status) + 1) + "&orderType=grabGroup"
    }) : "lease_order" === a ? wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + (Number(t.status) + 1) + "&orderType=lease_toy"
    }) : "live_install_work_order" === a ? -1 === t.status ? wx.navigateTo({
      url: "/packageH/installationSever/installationSeverHome/installationSeverHome?status=1"
    }) : wx.navigateTo({
      url: "/packageH/installationSever/installationSeverHome/installationSeverHome?status=" + t.status
    }) : "live_install_order" === a ? 3 === t.status ? wx.navigateTo({
      url: "/packageH/installationSever/installationSeverMemberHome/installationSeverMemberHome?status=5"
    }) : wx.navigateTo({
      url: "/packageH/installationSever/installationSeverMemberHome/installationSeverMemberHome?status=" + (Number(t.status) + 1)
    }) : "aggregation_cps_order" === a ? 3 === t.status ? wx.navigateTo({
      url: "/packageA/member/order/cpsCoupon/cpsCoupon"
    }) : wx.navigateTo({
      url: "/packageA/member/order/cpsOrder/cpsOrder?status=" + t.status
    }) : "group_work_order" === a ? wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + (Number(t.status) + 1) + "&orderType=groupWork"
    }) : "ywm_fight_groups_order" === a ? wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + Number(t.status) + "&orderType=ywmgroups"
    }) : "coupon_store_order" === a ? wx.navigateTo({
      url: "/packageF/consumption/orderList/orderList?status=" + Number(t.status)
    }) : "travel_around_order" === a ? wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + (Number(t.status) + 1) + "&orderType=travelAround"
    }) : "yz_supply_cake_order" === a && wx.navigateTo({
      url: "/packageA/member/myOrder_v2/myOrder_v2?status=" + (Number(t.status) + 1) + "&orderType=sachertorte"
    }) : this.goaftersaleslist();
  },
  handlePlugin: function (a) {
    var i = this;
    return t(e.default.mark(function t() {
      var o;
      return e.default.wrap(function (e) {
        for (;;) switch (e.prev = e.next) {
          case 0:
            if (o = "", a.detail ? o = a.detail.name : a.name && (o = a.name), i.setData({
                plugin_active: o
              }), i.data.decorate_isLoadMore = !0, 1 != i.data.store_alone_temp) {
              e.next = 7;
              break;
            }
            return i.getPlugins("plugin.store-alone-temp.frontend.member.nav-data", {
              page: 1,
              code: i.data.plugin_active
            }, i.data.plugin_active), e.abrupt("return");

          case 7:
            "limitBuy_goods" === i.data.plugin_active ? i.data.limitData.list || i.getPlugins("member.member.plugin-data", {
              code: i.data.plugin_active,
              page: 1
            }, i.data.plugin_active) : "fight-groups" === i.data.plugin_active ? i.data.groupList.length <= 0 && i.getPlugins("plugin.fight-groups.frontend.controllers.fight-groups.index", {
              page: 1
            }, i.data.plugin_active) : "article" === i.data.plugin_active ? i.data.articleData.list || i.getPlugins("plugin.article.api.article.get-articles", {
              category_id: 0,
              pageSize: 12,
              page: 1
            }, i.data.plugin_active) : "video-share" === i.data.plugin_active ? i.data.videoData.list || i.getPlugins("plugin.video-share.frontend.video.getList", {
              page: 1
            }, i.data.plugin_active) : "micro-communities" === i.data.plugin_active ? i.data.communityData.list || i.getPlugins("plugin.micro-communities.api.index.getStick", {
              trick_new: 1,
              page: 1
            }, i.data.plugin_active) : "room" === i.data.plugin_active && (i.data.liveData.list || i.getPlugins("plugin.room.frontend.live-list.get-all-live-list", {
              page: 1
            }, i.data.plugin_active));

          case 8:
          case "end":
            return e.stop();
        }
      }, t);
    }))();
  },
  getPlugins: function (e, t, o) {
    var r = this,
      s = i.getNetAddresss(e);
    i._getNetWork({
      url: s,
      data: t,
      success: function (e) {
        var t = e.data;
        1 == t.result && ("recommend_goods" === o ? r.setData(a({}, "goodsData.list", t.data.data)) : "limitBuy_goods" === o ? r.setData(a({}, "limitData.list", t.data.data)) : "fight-groups" === o ? (r.setData({
          groupList: r.data.groupList.concat(t.data.data),
          groupListPage: t.data.current_page,
          groupListTotalPage: t.data.last_page
        }), r.data.decorate_isLoadMore = !0) : "article" === o ? r.setData(a({}, "articleData.list", t.data.articles)) : "video-share" === o ? r.setData(a({}, "videoData.list", t.data.list)) : "micro-communities" === o ? r.setData(a({}, "communityData.list", t.data)) : "room" === o && r.setData(a({}, "liveData.list", t.data)));
      }
    });
  },
  getMorePluginData: function () {
    this.data.decorate_isLoadMore = !1;
    var e = this.data.plugin_active;
    if ("recommend_goods" === e) this.selectComponent("#recommend_goods").loadMoreMemberData();
    else if ("limitBuy_goods" === e) {
      this.selectComponent("#limitBuy_goods").loadMoreMemberData();
    } else if ("fight-groups" === e) {
      if (this.data.groupListPage < this.data.groupListTotalPage) {
        this.data.groupListPage += 1;
        var t = "plugin.fight-groups.frontend.controllers.fight-groups.index";
        1 == this.data.store_alone_temp && (t = "plugin.store-alone-temp.frontend.member.nav-data"),
          this.getPlugins(t, {
            page: this.data.groupListPage,
            code: this.data.plugin_active
          }, e);
      }
    } else if ("article" === e) {
      this.selectComponent("#article_box").getMoreData();
    } else if ("video-share" === e) {
      this.selectComponent("#video_share").loadMoreMemberData();
    } else if ("micro-communities" === e) {
      this.selectComponent("#micro_communities").getMoreData();
    } else if ("store-cashier" === e) {
      this.selectComponent("#store_cashier").getMoreList();
    } else "room" === e && (this.data.decorate_isLoadMore = !0);
  },
  setLoadMore: function (e) {
    this.setData({
      decorate_isLoadMore: e.detail.isLoadMore
    });
  },
  openService: function () {
    this.setData({
      showPopup: !0
    });
  },
  closeService: function () {
    this.setData({
      showPopup: !1
    });
  },
  getPhoneNumber: function (a) {
    var i = this;
    return t(e.default.mark(function t() {
      var o, r;
      return e.default.wrap(function (e) {
        for (;;) switch (e.prev = e.next) {
          case 0:
            if ("getPhoneNumber:ok" != (o = a.detail).errMsg) {
              e.next = 13;
              break;
            }
            return e.next = 4, i.getPhone_index(o.code);

          case 4:
            return r = e.sent, i.data.AuthorizedPhone = r, e.next = 8, i.getPrepBind(r);

          case 8:
            return e.next = 10, i.setBindPhone();

          case 10:
            i.getInvite(), e.next = 14;
            break;

          case 13:
            i.getInvite();

          case 14:
          case "end":
            return e.stop();
        }
      }, t);
    }))();
  },
  getPhoneM: function () {
    return new Promise(function (e, t) {
      wx.checkSession({
        success: function (t) {
          e();
        },
        fail: function (e) {
          t(e);
        }
      });
    });
  },
  getSessionKey: function () {
    var e = wx.getStorageSync("session");
    console.log(e, "缓存的session");
    var t = i.getNetAddresss("member.mini-decrypt.getSessionKey");
    return new Promise(function (a, o) {
      i._postNetWork({
        url: t,
        data: {
          session_key_id: e,
          not_validate_page: "0"
        },
        showToastIn: !1,
        success: function (e) {
          var t = e.data;
          if (1 == t.result) {
            if (console.log(t, "获取session_key"), 1 == t.result) {
              var i = t.data.session_key_data.session_key;
              a(i);
            }
          } else wx.showToast({
            icon: "none",
            title: t.msg,
            duration: 1500
          }), o();
        },
        fail: function (e) {
          o(e);
        }
      });
    });
  },
  getPhone_index: function (e) {
    wx.showLoading({
      title: "加载中"
    });
    var t = i.getNetAddresss("member.member.miniMemberMobile");
    return new Promise(function (a, o) {
      i._postNetWork({
        url: t,
        showToastIn: !1,
        validateBol: 2,
        data: {
          code: e,
          not_validate_page: "0"
        },
        success: function (e) {
          var t = e.data;
          1 == t.result ? a(t.data.phone_info.purePhoneNumber) : (wx.hideLoading({
            success: function (e) {}
          }), wx.showToast({
            icon: "none",
            title: t.msg,
            duration: 1500
          }), o());
        },
        fail: function (e) {
          o(e);
        }
      });
    });
  },
  setBindPhone: function (e) {
    var t = this;
    wx.hideLoading({
      success: function (e) {}
    });
    var a = i.getNetAddresss("member.member.bindMobile");
    return new Promise(function (e, o) {
      i._postNetWork({
        url: a,
        data: {
          mobile: t.data.AuthorizedPhone,
          mini_first_time_bind: 1
        },
        success: function (a) {
          var i = a.data;
          t.data.changidInfo && t.data.changidInfo.change_uid && wx.setStorage({
            key: "yz_uid",
            data: t.data.changidInfo.change_uid
          }), wx.showToast({
            icon: "none",
            title: i.msg,
            duration: 1500
          }), t.getInvite(), e();
        },
        fail: function (e) {
          o(e);
        }
      });
    });
  },
  closeChangeId: function () {
    this.setData({
      showChangeID: !1
    });
  },
  getPrepBind: function (e) {
    var t = this,
      a = i.getNetAddresss("member.member.prepBind");
    return new Promise(function (o, r) {
      i._postNetWork({
        url: a,
        showToastIn: !1,
        data: {
          mobile: e,
          not_validate_page: "0"
        },
        validateBol: 2,
        success: function (e) {
          var a = e.data;
          if (1 == a.result)
            if (a.data.is_show) {
              wx.hideLoading({
                success: function (e) {}
              });
              var i = wx.getStorageSync("yz_basic_info");
              t.setData({
                balance: i.balance,
                point: i.point,
                showChangeID: !0,
                changidInfo: {
                  uid: a.data.uid,
                  change_uid: a.data.change_uid
                }
              });
            } else o();
          else wx.showToast({
            icon: "none",
            title: a.msg,
            duration: 1500
          }), r(a);
        },
        fail: function (e) {
          r(e);
        }
      });
    });
  }
});